<!DOCTYPE html>
<html lang="en">
<include file="CommonSidebar:common-head"/>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/css/common.css">
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/css/bootstrap-datetimepicker.css" rel="stylesheet">
<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-md-12">
                <h1 class="page-header">所有文章</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" data-parent="#accordion"
                                   href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                    操作
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"
                             aria-labelledby="headingOne">
                            <div class="panel-body">
                                <div class="form-group">
                                    <div class="col-sm-3">
                                        <a target="_blank" href="{:U('Articles/EditAddIndex')}"><button class="btn  btn-primary" >添加文章</button></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">

                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <include file="Extends/searchForUser"/>
                                <thead>
                                <tr>
                                    <th style="text-align:center" width="30%">文章标题</th>
                                    <th style="text-align:center">收藏数</th>
                                    <th style="text-align:center" width="30%">点赞数</th>
                                    <th style="text-align:center">创建时间</th>
                                    <th style="text-align:center">来源</th>
                                    <th style="text-align:center">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="DATA" item="v" key="k">
                                    <tr class="odd gradeX">
                                        <td>{$v.TITLE}</td>
                                        <td style="vertical-align:middle;">{$v.SC_NUM}</td>
                                        <td style="vertical-align:middle;">{$v.DZ_NUM}</td>
                                        <td style="vertical-align:middle;">{$v.CREATE_TIME}</td>
                                        <td style="vertical-align:middle;">{$v.SOURCE}</td>
                                        <td style="vertical-align:middle;">
                                            <a target="_blank" href="{:U('Articles/EditAddIndex')}?ID={$v.ID}"
                                               class="btn btn-warning btn-xs"
                                               title="Edit">查看/编辑</a>
                                            <a href="javascript:void(0)" onclick="Delete('{$v.ID}',$(this))"
                                               class="btn btn-danger btn-xs" title="Delete">删除</a>
                                            <a
                                               class="btn btn-warning btn-xs"
                                               title="Edit">预览</a>
                                        </td>

                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                            <div class="blue">{$show}</div>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->
</div>


<include file="CommonSidebar:common-script"/>
<script src="__PUBLIC__/Admin/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="__PUBLIC__/Admin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
<script src="__PUBLIC__/Common/grid.js"></script>
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<script type="text/javascript">
    $('#dataTables-example').grid();
</script>
<script>
    function Delete(ID, elem) {
        if (confirm("确认删除？")) {
            $.post("{:U('Del')}",
                    {ID: ID},
                    function (data) {
                        if (data) {
                            alert('删除成功');
                            elem.parent().parent().remove();
                        } else {
                            alert('删除失败');
                        }
                    });
        }
    }

</script>
</body>
</html>
